<%--
 *  File:   DMSDetail.jsp

 *  Desc:	
 *
 *  Date	  :	 2010-07-12 11:25        		    
 *  Author	:  kenfang
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%
	//init param
  String privilegeCode = "FP0201";
  String strModuleName = "COM";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>

<html>
<head>
<title>FileColumnMappingCustomer</title>
<PageFlow:CheckPageFlow pageName="p_mdsdetail"/>
<%@ include file="/inc/AlertError.inc" %>
<%

	String mdsid = "";
	if (pageContext.getAttribute("mdsid")!= null )
	mdsid = pageContext.getAttribute("mdsid").toString();

  Vector details = (Vector)pageContext.getAttribute("details");
  if(details == null) details = new Vector();
  Vector allnotusedfields=(Vector)pageContext.getAttribute("allfields");
  if(allnotusedfields == null) allnotusedfields = new Vector();
  String disabled = "disabled";
  String strIsCheckNeed = new String("");
%>
<%
	//params
     String viewflag = "";

     if(pageContext.getAttribute("viewflag") != null&&((String)pageContext.getAttribute("viewflag")).equals("view")) {

           viewflag = "view";
     }
     String strIsDefault = null;
  //params end
  
  //HashMap plantypekpiinfo = null;

  //plantypekpiinfo = (HashMap)pageContext.getAttribute("plantypekpiinfo");
  
  
  
  HashMap mdsdetailinfo = null;
  String valuemdsdetailid = null;
  String dateOpt = null;
  mdsdetailinfo = (HashMap)pageContext.getAttribute("mdsdetailinfo");
	  if(mdsdetailinfo != null&&mdsdetailinfo.size()!=0) {

		dateOpt = JspHelper.filterNull( mdsdetailinfo.get("createdate") ).toString();
      }else {
    	  mdsdetailinfo = new HashMap();
    	  mdsdetailinfo.put("status",new Integer(10));
    	  mdsdetailinfo.put("createdate",new java.sql.Date(System.currentTimeMillis()));
		  pageContext.setAttribute("mdsdetailinfo",mdsdetailinfo);
		  valuemdsdetailid = "";
		  mdsdetailinfo = (HashMap)pageContext.getAttribute("mdsdetailinfo");
      }
	  
  	HashMap userinfo = (HashMap)session.getAttribute("userinfo");
	String dateFormat = (String)session.getAttribute("dateformat");
	if(dateFormat==null)dateFormat = "yyyy-MM-dd";
	 
%>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript">

function page_add()
{
    if(!checkALLElems(document.getElementById("newdetail"))) return;
    //if(document.cform.isneedflag.checked)
  	
    cform.actionname.value = "add";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_delete()
{
    if(isNullChecked(cform.deleteids))
    {
        alert("<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>");
        return;
    }
    if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
    
    cform.actionname.value = "delete";


    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_save()
{
    if(!checkALLElems(document.getElementById("olddetail"))) return;
    cform.actionname.value = "save";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_back()
{  
  parent.location.href = "MDSManagement.jsp?<%= OvalTools.randomURL() %>&languagecode=<%= strLanguageCode%><%=JspHelper.filterNull( strIsDefault )%>";
}
function allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('deleteids');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = true;
		}
	}else{
		for(var i = 0 ; i < length;i++){
			alldatafile[i].checked = false;
		}	
	}
}

<%
String strDisplayFlag="";
if(request.getParameter("displayflag")!=null)
{
  strDisplayFlag=request.getParameter("displayflag");
}
%>
var popwindow;
function page_yearplan(url){

	

	   var targetWndName = "YearplanSummary";  
	   var wnd = window.open("<%=contextPath%>/FP/Yearplan/YearplanSummary.jsp",targetWndName);  
	   var link = document.getElementById("link");  
	   link.target = targetWndName;  
	   link.href = url;  
	   link.click(); 

	  	}

function setYearPlan(id,code,name)
{
   document.cform.yearplanid.value=id;
   document.cform.yearplancode.value=code;
   document.cform.yearplanname.value=name;
}
</script>
<body style="overflow: auto;">
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher" >
  <input type="hidden" name="pagename" value="p_mdsdetail">
  <input type="hidden" name="actionname">
  <input type="hidden" name="numrows" value="<%= details.size() %>">
  <custom:hidden name="userinfo" property="userid" scope="session"/>
  <custom:hidden property="mdsid"  value="<%= mdsid %>"/>
<table border=0 cellpadding=0 cellspacing=0 width="100%">
  <tr>
    <td valign=top>
      <table border=0 cellpadding=1 cellspacing=0 width="100%">
      
        <tr>
          <td bgcolor=#000000 style="PADDING-BOTTOM: 1px; PADDING-LEFT: 1px; PADDING-RIGHT: 1px; PADDING-TOP: 0px">
            <table bgcolor=#000000 border=0 cellpadding=0 cellspacing=0 width="100%">
              <tr>
                <td  bgcolor=#ffffff style="PADDING-BOTTOM: 3px; PADDING-LEFT: 3px; PADDING-RIGHT: 3px; PADDING-TOP: 3px">
                  <div id=div2 style="HEIGHT: 415px; OVERFLOW: auto">
                    <table border="1" cellspacing="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" align="center" width="100%" cellpadding="1">

<%--    top function buttons    --%>
<%	if(!viewflag.equals("view")){%>
                    <tr>
                        <td colspan="20" class="td_right">
                          <a onclick="page_add();"><custom:button type="2" label="L_Add" imgsrc="add_btn.gif" border="0"/></a>
                        <%if(details.size()>0 ){%>
                          <a onclick="page_delete();"><custom:button type="2" label="L_Delete" imgsrc="delete_btn.gif" border="0"/></a>
                          <%}%>
                        </td>
                      </tr>
<%}%>
<tr  class="deepblue-left"> 
			<td width="22" class="title_center">
			<input type="checkbox" name="allcheck" class="normalradio" onclick="allcheckselect();">
			</td>
			<td  class="title_center"><%= label.getLabelName("L_Num")%></td>
            <td  class="title_center"><%= label.getLabelName("L_theYear")+label.getLabelName("L_MainMarketPlan")%><font color="red">*</font></td>
            <td  class="title_center"><%= label.getLabelName("L_Description")%></td>
            <td  class="title_center"><%= label.getLabelName("L_CreateTime")%></td>
            
</tr>


  
         

<span id="olddetail" >

              <logic:iterate id="onerow" collection="<%= details %>" indexId="idx">
                      <tr>
                        <td width="30">
                   		<custom:checkbox  property="mdsdetailid" name="onerow" changedName="deleteids" styleClass="normalradio" />
                        </td>
                        
                        <td>&nbsp;<%=idx.intValue()+1%></td>
                        <td>&nbsp;<custom:write name="onerow" property="yearplanname" /></td>
                        <td>&nbsp;<custom:write property="comments" name="onerow"/></td>
                        <td>&nbsp;<custom:write property="createdate" name="onerow"/></td>
						
                       
                   </tr>
                   <tr>
                        <td style="display:none">
                            <custom:hidden property="yearplanid" name="onerow" colIndex="<%=idx%>"/>
                            

                            
                         </td>
                      </tr>
            </logic:iterate>
</span>

<%	if(!viewflag.equals("view")){%>
<span id="newdetail" >
                      <tr >
                        <td>&nbsp;</td>
                        <td>&nbsp;<custom:hidden name="newdetail" property="mdsdetailid" /></td>
                        
                        <td>
                        <custom:text name="newdetail" property="yearplancode" />
                        <a onclick='window.open("<%=contextPath%>/FP/Yearplan/YearplanSummary.jsp?<%= OvalTools.randomURL() %>&mdsid=" + <%= mdsid %>, "newwindow", "height=400, width=600,top=120,left=120,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=yes")'> 
                        <custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a>
                        
                        <custom:text name="newdetail" property="yearplanname" />
                        <custom:hidden name="newdetail" property="yearplanid" />
                        </td>
                        <td><custom:text name="newdetail" property="comments" label="L_Description"/></td>
                        <td><custom:text name="mdsdetailinfo" property="createdate" label="L_CreateTime"/></td>
                        
                      </tr>

                      <tr>
                        <td style="display:none">
								<td><custom:hidden name="newdetail" property="createdate"/></td>
                        </td>
                      </tr>
</span>
   <%}%>   

                    </table>
                  </div>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
      <table width="100%" cellspacing="0" cellpadding="0">
         <tr><td class="summary_top"></td></tr>
         <tr>
           <td class="td_center">
          
             <a onclick="page_back();"><custom:button type="1" label="L_Back" imgsrc="new.gif" border="0" style="width:60"/></a>
          
           </td>
         </tr>
      </table>
    </td>
  </tr>
</table>
</form>
</body>
<script>

</script>
</html>